<template>
	<view class="mainpadding2 beijingse1">
		<view class="flexcolumn" v-if="!list.data.length">
			<view class="placeholderimage" style="margin-top: 100rpx;"></view>
			<view class="xiaohui ershil margin_top5">暂无数据</view>
		</view>
		<view class="ffffff mainpadding flextop margin_top" v-for="item in list.data" :key="item.id" @click="tzjpxq(item.goods.id,item.id)">
			<view class="dingwei margin_right2">
				<image style="width: 168rpx;height: 168rpx;" :src="item.goods.image_text" mode=""></image>
				<view class="djsbox flexcenter" v-if="item.goods.goods_status==1 || item.goods.goods_status==2">
					<view class="margin_right0">倒计时</view>
					<view class="margin_right0" v-if="item.goods.goods_status==1">
						<u-count-down :time="item.goods.start_time*1000 - Number(new Date())" format="HH:mm:ss"></u-count-down>
					</view>
					<view class="margin_right0" v-if="item.goods.goods_status==2">
						<u-count-down :time="item.goods.end_time*1000 - Number(new Date())" format="HH:mm:ss"></u-count-down>
					</view>
				</view>
				<view class="djsbox2 flexcenter" v-if="item.goods.goods_status==3">拍卖已结束</view>
			</view>
			<view class="flexcolumn" style="width: 70%;justify-content: space-between;align-items: flex-start;height: 168rpx;">
				<view class="ershiba xiaohei xiankuan">{{item.goods.name}}</view>
				<view class="flexbetween" style="width: 100%;">
					<view class="strongtext margin_top" style="color: #555555;">您的出价：
						<text class="sanshier xiaohong fonweight">￥{{item.price}}</text>
					</view>
					<!-- dataAll.usergoodsprice.status状态:1=未出局,2=已出局,3=成功 -->
					<image style="width: 106rpx;height: 106rpx;" src="../static/image/system/cg.png" v-if="item.status==3" mode=""></image>
					<image style="width: 106rpx;height: 106rpx;" src="../static/image/system/cj.png" v-if="item.status==2"  mode=""></image>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	const httpRequest = require("@/common/httpRequest.js")
	export default {
		data() {
			return {
				page: 1,
				limit: 12,
				list: {
					data: []
				},
				is_login:false
			}
		},
		onShow() {
			this.is_login = httpRequest.checkIsLogin();
			if (this.is_login) {
				this.init()
			} else {
				this.page = 1
				this.list = {
					data:[]
				}
			}
		},
		onShareAppMessage: function(options) {
			return {
				title: '速鉴奢拍 为二奢同行交易赋能',
				imageUrl: '',
				path: '/pages/homepage?code=' + uni.getStorageSync("invite_code")
			}
		},
		methods: {
			init(isPage, page) {
				let _this = this
				httpRequest.request('/api/user/myGoodsPrice', 'GET', {
					page: page || 1,
					limit: 12
				}).then(res => {
					uni.stopPullDownRefresh()
					if (res.code == 1) {
						let resList = res.data;
						let dataList = _this.list;
						if (isPage == true) {
							_this.list.data = dataList.data.concat(resList.data);
						} else {
							this.list = res.data
							_this.list.data = resList.data;
						}
					}
				}).catch(err => {
					httpRequest.toast(err.msg);
				})
			},
			onReachBottom() {
				let _this = this;
				let list = _this.list;
				let page = _this.page;
				if (list.last_page <= page) {
					return false;
				}
				page++;
				_this.page = page;
				_this.init(true, page);
			},
			// 跳转竞拍详情
			tzjpxq(id,jpid) {
				uni.navigateTo({
					url: '/pages_homepage/jingpaixq?id='+id+"&jpid="+jpid
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	/deep/.u-count-down__text{
		color: #fff !important;
		font-size: 20rpx !important;
		line-height: 20rpx !important;
	}
	.beijingse1 {
		background: #F5F5F5;
		min-height: calc(100vh - 0rpx);
		height: auto;
	}
	.djsbox {
		position: absolute;
		bottom: 0;
		left: 0;
		font-weight: 400;
		font-size: 20rpx;
		color: #FFFFFF;
		width: 168rpx;
		height: 36rpx;
		background: linear-gradient(90deg, #C4A25D 0%, #AE842F 100%);
	}
	.djsbox2{
		position: absolute;
		bottom: 0;
		left: 0;
		font-weight: 400;
		font-size: 20rpx;
		color: #FFFFFF;
		width: 168rpx;
		height: 36rpx;
		background-color: #999897;
	}
</style>